/*
 * @Author: Bowen 849084209@qq.com
 * @Date: 2023-02-01 20:24:04
 * @LastEditors: Bowen 849084209@qq.com
 * @LastEditTime: 2023-02-13 20:43:34
 * @FilePath: \ming\demo1\src\main\java\com\ming\demo1\MingApplication.java
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
package com.ming.demo1;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import com.ming.ming.MingConfig;

@SpringBootApplication
public class MingApplication {
	
	public static void main(String[] args) {
		SpringApplication.run(MingApplication.class, args);
		System.out.println("demo1启动！");
		
	}
	
	@Value("${server.port}")
	private Integer port;
	
	private final static String ipAddress = "127.0.0.1";
	
	@Bean
	public MingConfig getMingConfig() throws Exception {
		
		// 初始化
		MingConfig mg = MingConfig.init(port, ipAddress, ""+port);

		// 注册自己
		mg.getGossipService().start();
		
		return mg;
	}
	
	
	
}
